package com.learn.security.modules.vo;

import com.learn.security.modules.user.entity.UserInfo;
import lombok.Data;

/**
 * @author lee
 */
@Data
public class UserDto {

    /**
     * 登录用户ID
     */
    private Long id;

    /**
     * 用户名称
     */
    private String name;

    /**
     * 用户身份证
     */
    private String idCard;

    /**
     * 车牌号
     */
    private String plateNo;

    /**
     * 手机号
     */
    private String mobile;

    /**
     * 验证码
     */
    private String smsCode;

    /**
     * 微信openid
     */
    private String openId;

    public static UserDto toUser(String plateNo, String mobile) {
        UserDto user = new UserDto();
        user.setPlateNo(plateNo);
        user.setMobile(mobile);
        return user;
    }

    public static UserDto toUser(UserInfo userInfo) {
        UserDto user = new UserDto();
        user.setId(userInfo.getId());
        user.setName(userInfo.getName());
        user.setIdCard(userInfo.getIdCard());
        user.setOpenId(userInfo.getOpenId());
        user.setPlateNo(userInfo.getPlateNo());
        user.setMobile(userInfo.getMobile());

        return user;
    }
}
